package exam2013;

@SuppressWarnings("static-access")
class P1Q3 {
	
	private static class A {
		public int x=10, y=11;
		public int getX() {
			return x;
		}
		public void setY(int y) {
			this.y = y;
		}
	}
	
	private static class B extends A {
		public static int x = 255;
		public void plop(int _x) {
			x = _x;
			setY(x);
		}
	}
	
	private static class C1 extends B {
		public void setY(int y) {
			this.y = y;
		}
	}
	
	private static class C2 extends B {
		public byte x = (byte)super.x;
		public int y = 20;
		public int getX() {
			return x;
		}
		public void plop(int x) {
			x *= 2;
			super.plop(x);
		}
		public void setY(int y) {
			super.y = y;
		}
	}

	
	//for simplifying debugging
	static A a = new C2();
	static B b = new B();
	static C1 c1 = new C1();
	static C2 c2 = (C2)a;

	public static void main(String[] args) {
		System.out.println(a.x);
		System.out.println(c1.x);
		System.out.println(a.getX());
		System.out.println(c1.getX());
		b.x += 10;
		c1.x += 10;
		System.out.println(b.x);
		c2.plop(200);
		c1.plop(300);
		System.out.println(a.y);
		System.out.println(c1.y);
		System.out.println(c2.y);
	}
	
}
